﻿@model KhuyenMaiVang.DAL.Voucher
@using KhuyenMaiVang.HtmlHelpers;
<div class="home-first-deal-item box-item">
    <div class="first-deal-pic">
        @Html.ImageLink("VoucherDetail", "Home", Model.Thumb, Model.Title, new { id = Model.ID })
    </div>
    <div class="first-deal-info">
        <div class="first-deal-title">
            @Html.ActionLink(Model.Title, "VoucherDetail", "Home")
        </div>
        <div class="first-deal-desc">
           @Html.Raw(Model.Description)
        </div>
        <div class="first-deal-action">
            <div class="first-deal-more">
                <div class="first-deal-sell">
                    @{
                      var sell = "?";
                      if( Model.SellPrice.HasValue)
                      {
                          sell = Model.SellPrice.Value.ToString("#,#.#");
                      }
                    }
                    @sell VND
                </div>
                <div class="first-deal-cost">
                    Giá gốc: <span class="gia-goc">@Model.CostPrice.Value.ToString("#,#.#") VNĐ</span>
                </div>
                <div class="first-deal-count">
                    @{
                        String save = "?";
                        if (Model.CostPrice.HasValue && Model.CostPrice != 0 && Model.SellPrice.HasValue)
                        {
                            save = ((1 - Model.SellPrice / Model.CostPrice) * 100).Value.ToString("#,#.#");                            
                        }   
                    }
                    Tiết kiệm: <em>@save</em>
                </div>
                <div class="first-deal-count">
                    Số người mua: <em>199</em>
                </div>
            </div>
            <div class="first-deal-order">
                @{
                    TimeSpan timeout = (Model.EndTime.Value - DateTime.Now);
                  }
                <div class="first-deal-time">
                <span class="clockCountDown" d="@timeout.Days" h="@timeout.Hours" m="@timeout.Minutes" s="@timeout.Seconds" ms="@timeout.Milliseconds" >@(timeout.Days + " : " + timeout.Hours + " : " + timeout.Minutes +" : "+ timeout.Seconds)</span>         
                </div>
                <div class="first-deal-button">
                    @Html.ActionLink(" ",  "VoucherDetail","Home", new { id = Model.ID }, null)
                </div>
            </div>
        </div>
    </div>
</div>
